
#ifndef _TME_LOG_H_
#define _TME_LOG_H_

#include <stdio.h>
#include <stdint.h>
#include <stdarg.h>

typedef enum {
    TME_LOG_TYPE_INFO = 0,
    TME_LOG_TYPE_ERR,
    TME_LOG_TYPE_DEBUG,
    TME_LOG_TYPE_HEX,
} TME_LOG_TYPE;

/* 限制1次打印数据量 */
#define TME_LOG_ONCE_SIZE (1024 * 8)

/* 启用详细打印(打印函数名和行号) */
#define TME_LOG_IN_DETAIL 1

/* 启用debug */
#define TME_LOG_IN_DEBUG 1

#define TME_INFO(...) tme_log_print(TME_LOG_TYPE_INFO,__FUNCTION__,__LINE__,__VA_ARGS__)
#define TME_ERR(...) tme_log_print(TME_LOG_TYPE_ERR,__FUNCTION__,__LINE__,__VA_ARGS__)
#define TME_DEBUG(...) tme_log_print(TME_LOG_TYPE_DEBUG,__FUNCTION__,__LINE__,__VA_ARGS__)
#define TME_HEX(buff,size) tme_log_print(TME_LOG_TYPE_HEX,__FUNCTION__,__LINE__,buff,size)

void tme_log_print(
    int32_t type,
    const char* function,
    int32_t line,
    const char* fmt, ...);

#endif // _TME_LOG_H_
